package ncit.io.example;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class MyExampleClass {
	
	public void readFromFileAndDisplay(String fileName) {
		try {
			FileInputStream is = new FileInputStream(fileName);
			int size = 1024;
			byte[] bytes = new byte[size];
			StringBuffer sb = new StringBuffer();
			while (is.read(bytes, 0, size) > 0) {
				String str = new String(bytes, "UTF-8");
				sb.append(str);
			}
			System.out.println(sb.toString());
		} catch (FileNotFoundException e) {
			//TODO1: in case the file is not found, read from the default file, which is glados.txt, 
			//and print that text
		} catch (IOException e) {
			//TODO2: treat this exception in the same catch as the previous one
			e.printStackTrace();
		}
	}
	
}
